package org.example.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.springcloud.result.CommonResult;
import org.example.springcloud.service.PaymentFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * Created with IntelliJ IDEA.
 *
 * @author Jandmla
 * Date: 2022/7/22
 * Time: 15:34
 * Description:
 */
@RestController
@Slf4j
public class OrderControllerImpl{

    private final PaymentFeignService service;

    public OrderControllerImpl(PaymentFeignService service) {
        this.service = service;
    }

    /**
     * 数据获取
     * @param id ID
     * @return 查询结果
     */
    @GetMapping(value = "consumer/payment/get/{id}")
    public CommonResult getPayment(@PathVariable("id") Long id) {
        return service.getPaymentById(id);
    }

    /**
     * 超时测试
     * @return 端口号
     */
    @GetMapping(value = "consumer/payment/geign/timeout")
    public String paymentFeignTimeout(){
        return service.paymentFeignTimeout();
    }

}